package com.bytezero.throwable;

import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * 
 * @Description  方法重写的规则之一：
 * @author Bytezero·zhenglei!        Email:420498246@qq.com
 * @version
 * @date 下午2:50:20
 * @   子类重写的方法抛出的异常类型不大于父类被重写的方法抛出的异常类型
 *      
 *
 */
public class OverrideTest {
	
	public static void main(String[] args) {
		OverrideTest test = new OverrideTest();
		test.display(new SubClass());
	}
 
	public void display(SuperClass s) {
		try {
			s.method();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

class SuperClass{
	
	public void method() throws IOException{
		
	}
}

class SubClass extends SuperClass{
	public void method()throws FileNotFoundException {
		
	}
	
}